package com.itheima.d1_junit;

import java.util.List;

//学生业务类
public class StudentService {

    /**
     * 查询所有学生信息
     *
     * @param students
     */
    public void findAllStudent(List<Student> students) {
        students.forEach(student -> System.out.println(student));
    }

    /**
     * 根据年龄查询学生信息
     *
     * @param students
     * @param age
     */
    public void findStudentByCondition(List<Student> students, int age){
        students.stream()
                .filter(student -> student.getAge() > age)
                .forEach(student -> System.out.println(student));
    }

    /**
     * 根据姓名查询学生信息
     *
     * @param students
     * @param name
     */
    public void findStudentByName(List<Student> students , String name){
        students.stream()
                .filter(student -> student.getName().equals(name))
                .forEach(student -> System.out.println(student));
    }
}
